<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
    <style>
         *{
                margin: 0px;
                padding: 0px;
                list-style: none;
            }
        button{
            width: 50px;
            height: 40px;
            margin: 10px 20px auto;
            
            background:rgb(13, 199, 106);
            margin-left: 102px;
            
        }
        h1{
            color: rgb(13, 199, 106);
            margin-left: 57px;
            margin-top: 40px;
        }
        div{
            width: 414px;
            height: 424px;
            background: url(pic.jpg);
            margin: auto;
            margin-top: 100px;
        }
        
    </style>
<body>
    <div><button id="start">开始</button>
        <button id="end">结束</button>
        <h1 id="txt">快快快，给我来抽奖吧</h1></div>
        <script>
            var tag=document.getElementById('txt');
            var start=document.getElementById('start');
            var end=document.getElementById('end');
            var timer;
            var list=['阿巴阿巴','哈哈哈','抽个寂寞','啦啦','冲','笑笑','抽到了hhhh'];
            console.log(list[0]);
            console.log(list.length);
            start.onclick=function(){
                clearInterval(timer);
                timer=setInterval(function(){
                    var n=parseInt(Math.random()*list.length);
                    tag.innerHTML=list[n]
                },100)
            }
            end.onclick=function(){
                clearInterval(timer);
            }
        </script>
</body>
</html>